package cn.iocoder.yudao.module.diy.api.config;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.diy.dal.dataobject.config.DiyConfigDO;
import cn.iocoder.yudao.module.diy.service.config.DiyConfigService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class DiyConfigApiImpl implements DiyConfigApi {
    @Resource
    private DiyConfigService diyConfigService;


    @Override
    public CommonResult<String> getConfig(Long tenantId, String key) {
        DiyConfigDO result=diyConfigService.getConfig(tenantId,key);
        return success(result.toString());
    }

    @Override
    public CommonResult<String> getConfigValue(String key) {
        return success(diyConfigService.getConfigValue(key).toString());
    }
}
